'use strict';

var app = angular
  .module('afasApp', [
    'ngCookies',
    'ngResource',
    'ngSanitize',
    'ui.router',
    'LocalStorageModule',
    'ui.bootstrap',
    'angularFileUpload'
  ]);


app.config(['$stateProvider', '$controllerProvider', '$urlRouterProvider', function ($stateProvider, $controllerProvider, $urlRouterProvider) {
  app.controller = $controllerProvider;

  $urlRouterProvider.otherwise('/');
  $stateProvider
  .state('home', {
    url: '/',
    templateUrl: 'views/main.html'
  })

  // #RECEPTIONIST MODULE
  .state('receptionist', {
    url: '/receptionist',
    templateUrl: 'views/modules/receptionist.index.html'
  })
  
  //        --STUDENT
  .state('receptionist.students', {
    abstract: true,
    url: '/students',
    templateUrl: 'views/masters/students/students.index.html'
  })
  .state('receptionist.students.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/students/students.list.html',
        controller: 'StudentsCtrl'
      }
    }
  })
  .state('receptionist.students.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/students/students.create.html',
        controller: 'StudentsCtrl'
      }
    }
  })
  .state('receptionist.students.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/students/students.show.html',
        controller: 'StudentCtrl'
      }
    }
  })
  .state('receptionist.students.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/students/students.edit.html',
        controller: 'StudentCtrl'
      }
    }
  })
  
  //        --COUNTRY
  .state('receptionist.countries', {
    abstract: true,
    url: '/countries',
    templateUrl: 'views/masters/countries/countries.index.html'
  })
  .state('receptionist.countries.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/countries/countries.list.html',
        controller: 'CountriesCtrl'
      }
    }
  })
  .state('receptionist.countries.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/countries/countries.create.html',
        controller: 'CountriesCtrl'
      }
    }
  })
  .state('receptionist.countries.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/countries/countries.show.html',
        controller: 'CountryCtrl'
      }
    }
  })
  .state('receptionist.countries.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/countries/countries.edit.html',
        controller: 'CountryCtrl'
      }
    }
  })
  
  //        --SEX
  .state('receptionist.sexes', {
    abstract: true,
    url: '/sexes',
    templateUrl: 'views/masters/sexes/sexes.index.html'
  })
  .state('receptionist.sexes.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/sexes/sexes.list.html',
        controller: 'SexesCtrl'
      }
    }
  })
  .state('receptionist.sexes.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/sexes/sexes.create.html',
        controller: 'SexesCtrl'
      }
    }
  })
  .state('receptionist.sexes.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/sexes/sexes.show.html',
        controller: 'SexCtrl'
      }
    }
  })
  .state('receptionist.sexes.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/sexes/sexes.edit.html',
        controller: 'SexCtrl'
      }
    }
  })
  
  //        --CITY
  .state('receptionist.cities', {
    abstract: true,
    url: '/cities',
    templateUrl: 'views/masters/cities/cities.index.html'
  })
  .state('receptionist.cities.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/cities/cities.list.html',
        controller: 'CitiesCtrl'
      }
    }
  })
  .state('receptionist.cities.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/cities/cities.create.html',
        controller: 'CitiesCtrl'
      }
    }
  })
  .state('receptionist.cities.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/cities/cities.show.html',
        controller: 'CityCtrl'
      }
    }
  })
  .state('receptionist.cities.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/cities/cities.edit.html',
        controller: 'CityCtrl'
      }
    }
  })
  
  //        --PROVINCE
  .state('receptionist.provinces', {
    abstract: true,
    url: '/provinces',
    templateUrl: 'views/masters/provinces/provinces.index.html'
  })
  .state('receptionist.provinces.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/provinces/provinces.list.html',
        controller: 'ProvincesCtrl'
      }
    }
  })
  .state('receptionist.provinces.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/provinces/provinces.create.html',
        controller: 'ProvincesCtrl'
      }
    }
  })
  .state('receptionist.provinces.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/provinces/provinces.show.html',
        controller: 'ProvinceCtrl'
      }
    }
  })
  .state('receptionist.provinces.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/provinces/provinces.edit.html',
        controller: 'ProvinceCtrl'
      }
    }
  })
  
  //        --CONTACTTYPE
  .state('receptionist.contacttypes', {
    abstract: true,
    url: '/contacttypes',
    templateUrl: 'views/masters/contact-types/contact.types.index.html'
  })
  .state('receptionist.contacttypes.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/contact-types/contact.types.list.html',
        controller: 'ContactTypesCtrl'
      }
    }
  })
  .state('receptionist.contacttypes.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/contact-types/contact.types.create.html',
        controller: 'ContactTypesCtrl'
      }
    }
  })
  .state('receptionist.contacttypes.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/contact-types/contact.types.show.html',
        controller: 'ContactTypeCtrl'
      }
    }
  })
  .state('receptionist.contacttypes.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/contact-types/contact.types.edit.html',
        controller: 'ContactTypeCtrl'
      }
    }
  })

  // #ADMIN MODULE
  .state('admin', {
    url: '/admin',
    templateUrl: 'views/modules/admin.index.html'
  })
  
  //        --USER
  .state('admin.users', {
    abstract: true,
    url: '/users',
    templateUrl: 'views/masters/users/users.index.html'
  })
  .state('admin.users.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/users/users.list.html',
        controller: 'UsersCtrl'
      }
    }
  })
  .state('admin.users.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/users/users.create.html',
        controller: 'UsersCtrl'
      }
    }
  })
  .state('admin.users.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/users/users.show.html',
        controller: 'UserCtrl'
      }
    }
  })
  .state('admin.users.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/users/students.edit.html',
        controller: 'UserCtrl'
      }
    }
  })
  
  //        --ROOM
  .state('admin.rooms', {
    abstract: true,
    url: '/rooms',
    templateUrl: 'views/masters/rooms/rooms.index.html'
  })
  .state('admin.rooms.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/rooms/rooms.list.html',
        controller: 'RoomsCtrl'
      }
    }
  })
  .state('admin.rooms.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/rooms/rooms.create.html',
        controller: 'RoomsCtrl'
      }
    }
  })
  .state('admin.rooms.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/rooms/rooms.show.html',
        controller: 'RoomCtrl'
      }
    }
  })
  .state('admin.rooms.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/rooms/rooms.edit.html',
        controller: 'RoomCtrl'
      }
    }
  })
  
  //        --TEACHERS
  .state('admin.teachers', {
    abstract: true,
    url: '/teachers',
    templateUrl: 'views/masters/teachers/teachers.index.html'
  })
  .state('admin.teachers.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/teachers/teachers.list.html',
        controller: 'TeachersCtrl'
      }
    }
  })
  .state('admin.teachers.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/teachers/teachers.create.html',
        controller: 'TeachersCtrl'
      }
    }
  })
  .state('admin.teachers.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/teachers/teachers.show.html',
        controller: 'TeacherCtrl'
      }
    }
  })
  .state('admin.teachers.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/teachers/teachers.edit.html',
        controller: 'TeacherCtrl'
      }
    }
  })
  
  //        --TERMS
  .state('admin.terms', {
    abstract: true,
    url: '/terms',
    templateUrl: 'views/masters/terms/terms.index.html'
  })
  .state('admin.terms.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/terms/terms.list.html',
        controller: 'TermsCtrl'
      }
    }
  })
  .state('admin.terms.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/terms/terms.create.html',
        controller: 'TermsCtrl'
      }
    }
  })
  .state('admin.terms.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/terms/terms.show.html',
        controller: 'TermCtrl'
      }
    }
  })
  .state('admin.terms.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/terms/terms.edit.html',
        controller: 'TermCtrl'
      }
    }
  })
  
  //        --COURSE TYPES
  .state('admin.coursetypes', {
    abstract: true,
    url: '/coursetypes',
    templateUrl: 'views/masters/course-types/course.types.index.html'
  })
  .state('admin.coursetypes.list', {
    url: '',
    views: {
      'main': {
        templateUrl: 'views/masters/course-types/course.types.list.html',
        controller: 'CourseTypesCtrl'
      }
    }
  })
  .state('admin.coursetypes.new', {
    url: '/new',
    views: {
      'main': {
        templateUrl: 'views/masters/course-types/course.types.create.html',
        controller: 'CourseTypesCtrl'
      }
    }
  })
  .state('admin.coursetypes.show', {
    url: '/:id',
    views: {
      'main': {
        templateUrl: 'views/masters/course-types/course.types.show.html',
        controller: 'CourseTypeCtrl'
      }
    }
  })
  .state('admin.coursetypes.edit', {
    url: '/:id/edit',
    views: {
      'main': {
        templateUrl: 'views/masters/course-types/course.types.edit.html',
        controller: 'CourseTypeCtrl'
      }
    }
  });
}]);
